/*
 * Syntelos 'SX'
 * Copyright (C) 1998, 2009  John Pritchard.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 */
package syntelos.sx;

import syntelos.lang.Statistics;

/**
 * The <code>"Sys/SX"</code> statistics.
 */
public abstract class Stats
    extends java.lang.Object
{

    public final static void SInit(){
        Stats.Install(syntelos.sys.Statistics.Instance);
    }

    public static void Install(Statistics statistics){
        statistics.setHeader(Stats.Response.Instance);
        statistics.setHeader(Stats.Hertz.Instance);
        statistics.setHeader(Stats.HertzMax.Instance);
        statistics.setHeader(Stats.Load.Instance);
    }


    public static class Response 
        extends syntelos.lang.statistic.Frame
    {
        public final static java.lang.String Name = "Sys/SX/Response";

        public final static Response Instance = new Response();

        private Response(){
            super(Name);
        }
    }

    public static class Hertz
        extends syntelos.lang.statistic.Hertz
    {
        public final static java.lang.String Name = "Sys/SX/Hertz";

        public final static Hertz Instance = new Hertz();


        private Hertz(){
            super(Name);
        }
    }

    public static class HertzMax
        extends syntelos.lang.statistic.Long
        implements alto.lang.Header.Update
    {
        public final static java.lang.String Name = "Sys/SX/Hertz/Max";

        public final static HertzMax Instance = new HertzMax();


        private HertzMax(){
            super(Name);
        }


        public void update(){
            super.update(Stats.Hertz.Instance.getMax());
        }
    }

    public static class Load 
        extends syntelos.lang.statistic.Long
        implements alto.lang.Header.Update
    {
        public final static java.lang.String Name = "Sys/SX/Load";

        public final static Load Instance = new Load();

        private Load(){
            super(Name);
        }


        public void update(){
            super.update(syntelos.sx.Socket.Queue.Depth());
        }
    }

}
